#论坛首页页面
import time
import os

from selenium.webdriver import Keys
from selenium.webdriver.common.by import By
from selenium.webdriver.support.expected_conditions import element_to_be_selected

from common.Utils import ForumDriver
class ForumFirst:
    url=""
    def __init__(self):
        self.url="http://127.0.0.1:58080/index.html"
        self.driver=ForumDriver.driver
        self.driver.get(self.url)
        #测试页面跳转到别的人板块
    def OTHPage(self):
        self.driver.find_element(By.CSS_SELECTOR,"#topBoardList > li:nth-child(4) > a > span.nav-link-title").click()
        self.driver.find_element(By.CSS_SELECTOR,"#article_list_board_title")
        ForumDriver.getScreenshot()
        time.sleep(1)
        self.driver.back()
    # #在首页点击其他用户的帖子标题，帖子详情页进入其他用户帖子详情页
    def OUPPage(self):
        # 在首页点击其他用户的帖子标题，帖子详情页进入其他用户帖子详情页
            self.driver.find_element(By.CSS_SELECTOR,
                                     "#artical-items-body > div:nth-child(1) > div > div.col > div.text-truncate > a > strong").click()
            time.sleep(1)
            self.driver.find_element(By.CSS_SELECTOR, "#btn_details_send_message")
            time.sleep(1)
            # 测试点赞数，0-1
            tex1 = self.driver.find_element(By.CSS_SELECTOR, "#details_article_likeCount").text
            print(tex1)
            self.driver.find_element(By.CSS_SELECTOR, "#details_btn_like_count").click()
            tex = self.driver.find_element(By.CSS_SELECTOR, "#details_article_likeCount").text
            print(tex)
            ForumDriver.getScreenshot()

            # 成功回复
            time.sleep(5)
            self.driver.execute_script("window.scrollBy(0,10000);")
            time.sleep(3)
            title_label = self.driver.find_element(By.CSS_SELECTOR,"#details_btn_like_count")
                        # tab键跳转到输入内容的位置
            title_label.send_keys(Keys.TAB)
            ele = self.driver.switch_to.active_element
            ele.send_keys("第二次测试")
            time.sleep(3)
            self.driver.find_element(By.CSS_SELECTOR, "#details_btn_article_reply > span").click()
            ForumDriver.getScreenshot()
            # tex=self.driver.find_element(By.CSS_SELECTOR, "#details_article_reply_content_11 > p").text
            # print(tex)
            # assert tex=="第二次测试"
            # time.sleep(1)

            self.driver.back()
     #点击自己的帖子标题
    def MyPage(self):
        time.sleep(1)
        self.driver.find_element(By.CSS_SELECTOR,"#artical-items-body > div:nth-child(4) > div > div.col > div.text-truncate > a > strong").click()
        time.sleep(3)
        ree=self.driver.find_element(By.CSS_SELECTOR,"#article_details_author_name").text
        print(ree)
        assert ree=="333"
        ForumDriver.getScreenshot()
        #点赞帖子
        t1=self.driver.find_element(By.CSS_SELECTOR,"#details_article_likeCount").text
        print(t1)
        self.driver.find_element(By.CSS_SELECTOR,"#details_btn_like_count").click()
        time.sleep(1)
        t2=self.driver.find_element(By.CSS_SELECTOR,"#details_article_likeCount").text
        print(t2)
        ForumDriver.getScreenshot()
        #点击编辑
        time.sleep(1)
        self.driver.find_element(By.CSS_SELECTOR,"#details_artile_edit > span").click()
        time.sleep(1)
        text=self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-header.d-print-none > div > div > div > h2").text
        print(text)
        ForumDriver.getScreenshot()
        time.sleep(1)
        self.driver.find_element(By.CSS_SELECTOR,"#edit_article_title").send_keys("加")
        time.sleep(5)
        self.driver.execute_script("window.scrollBy(0,10000);")
        time.sleep(3)
        self.driver.find_element(By.CSS_SELECTOR,"#edit_article_submit").click()
        ForumDriver.getScreenshot()
    def DelPage(self):
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#artical-items-body > div:nth-child(4) > div > div.col > div.text-truncate > a > strong").click()
        time.sleep(2)
        te=self.driver.find_element(By.CSS_SELECTOR,"#article_details_author_name").text
        print(te)
        assert te=="333"
        self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-body > div > div > div:nth-child(1) > div.col-9.card.card-lg > div.card-footer.bg-transparent.mt-auto.justify-content-end > div > div:nth-child(3) > div > a").click()
        time.sleep(2)
        ter=self.driver.find_element(By.CSS_SELECTOR,"#details_delete_modal > div > div > div.modal-body.text-center.py-4 > h3").text
        print(ter)
        #assert ter=="确定要删除当前帖子吗？"
        ForumDriver.getScreenshot()
        #点击取消
        self.driver.find_element(By.CSS_SELECTOR,"#details_delete_modal > div > div > div.modal-footer > div > div > div:nth-child(1) > a").click()
        ForumDriver.getScreenshot()
        time.sleep(2)
        #确定删除
        self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-body > div > div > div:nth-child(1) > div.col-9.card.card-lg > div.card-footer.bg-transparent.mt-auto.justify-content-end > div > div:nth-child(3) > div > a").click()
        self.driver.find_element(By.CSS_SELECTOR,"#details_artile_delete").click()
        time.sleep(2)
        ForumDriver.getScreenshot()

        #查看其他用户的个人主页，私信功能，页面
    def SewOthPage(self):
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#artical-items-body > div:nth-child(1) > div > div.col > div.text-truncate > a > strong").click()
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-body > div > div > div:nth-child(1) > div.col-3.card > div > h3").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        time.sleep(2)
        #点击发私信
        self.driver.find_element(By.CSS_SELECTOR,"#btn_profile_send_message").click()
        ForumDriver.getScreenshot()

        #点击取消
        self.driver.find_element(By.CSS_SELECTOR,"#index_message_receive_cancel").click()
        ForumDriver.getScreenshot()
        #发送异常
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#btn_profile_send_message").click()
        time.sleep(1)
        self.driver.find_element(By.CSS_SELECTOR,"#btn_index_send_message").click()
        ForumDriver.getScreenshot()

        #成功发送
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#btn_profile_send_message").click()
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#index_message_receive_content").send_keys("第一条私信发送")
        time.sleep(1)
        self.driver.find_element(By.CSS_SELECTOR, "#btn_index_send_message").click()
        ForumDriver.getScreenshot()

        #系统界面，搜索，等
    def sysPage(self):
        #搜索
        self.driver.find_element(By.CSS_SELECTOR,"body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input").send_keys("3")

        time.sleep(2)
        title_label= self.driver.find_element(By.CSS_SELECTOR,"body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div.nav-item.d-none.d-md-flex.me-3 > div > form > div > input")
        time.sleep(2)
        title_label.send_keys(Keys.ENTER)
        time.sleep(2)
        ele = self.driver.switch_to.active_element
        time.sleep(2)
        ForumDriver.getScreenshot()
        #模式切换
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div:nth-child(2) > a.nav-link.px-0.hide-theme-dark > svg").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        self.driver.find_element(By.CSS_SELECTOR,"body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div:nth-child(2) > a.nav-link.px-0.hide-theme-light > svg").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        self.driver.find_element(By.CSS_SELECTOR,
                                    "body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div:nth-child(2) > a.nav-link.px-0.hide-theme-dark > svg").click()
        time.sleep(2)

     #站内信

        self.driver.find_element(By.CSS_SELECTOR,"body > div.page > header.navbar.navbar-expand-md.navbar-light.d-print-none > div > div > div:nth-child(2) > div > a > svg").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        #点击一条信
        self.driver.find_element(By.CSS_SELECTOR,"#index_div_message_list > div:nth-child(1) > div > div.col.text-truncate > a > span:nth-child(2)").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        #取消，关闭信页面
        self.driver.find_element(By.CSS_SELECTOR,"#index_message_reply_cancel").click()
        ForumDriver.getScreenshot()
        time.sleep(2)
        #点击一条信
        self.driver.find_element(By.CSS_SELECTOR,"#index_div_message_list > div:nth-child(1) > div > div.col.text-truncate > a > span:nth-child(2)").click()
        time.sleep(2)
        #点击回复
        self.driver.find_element(By.CSS_SELECTOR,"#btn_index_message_reply").click()
        ForumDriver.getScreenshot()
        time.sleep(2)
        #异常回复。点击取消按钮
        self.driver.find_element(By.CSS_SELECTOR,"#index_message_reply_cancel").click()
        ForumDriver.getScreenshot()
        time.sleep(2)
        #发送空内容
        self.driver.find_element(By.CSS_SELECTOR,
                                 "#index_div_message_list > div:nth-child(1) > div > div.col.text-truncate > a > span:nth-child(2)").click()
        time.sleep(2)
        # 点击回复
        self.driver.find_element(By.CSS_SELECTOR, "#btn_index_message_reply").click()
        ForumDriver.getScreenshot()
        time.sleep(2)
        #异常回复。空内容

        self.driver.find_element(By.CSS_SELECTOR,"#btn_index_send_message_reply").click()

        time.sleep(1)
        ForumDriver.getScreenshot()
        # #成功发送
        self.driver.find_element(By.CSS_SELECTOR,
                                 "#index_div_message_list > div:nth-child(1) > div > div.col.text-truncate > a > span:nth-child(2)").click()
        time.sleep(2)
        # 点击回复
        self.driver.find_element(By.CSS_SELECTOR, "#btn_index_message_reply").click()
        ForumDriver.getScreenshot()
        time.sleep(2)
        #输入内容
        self.driver.find_element(By.CSS_SELECTOR, "#index_message_reply_receive_content").send_keys("huifu")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#btn_index_send_message_reply").click()

        time.sleep(1)
        ForumDriver.getScreenshot()
        self.driver.back()
        time.sleep(2)

    def DietPage(self):

            self.driver.find_element(By.CSS_SELECTOR,
                                     "#bit-forum-content > div.page-header.d-print-none > div > div > div.col-auto.ms-auto.d-print-none > div > a.btn.btn-primary.d-none.d-sm-inline-block.article_post").click()
            time.sleep(2)
            ForumDriver.getScreenshot()
           # self.driver.find_element(By.CSS_SELECTOR, "#article_post_borad").click()
            self.driver.find_element(By.CSS_SELECTOR, "#article_post_borad > option:nth-child(4)").click()
            time.sleep(2)
        #异常发布
            #1.不输入内容
            self.driver.find_element(By.CSS_SELECTOR,"#article_post_title").send_keys("123")

            self.driver.execute_script("window.scrollBy(0,10000);")
            time.sleep(2)
            self.driver.find_element(By.CSS_SELECTOR,"#article_post_submit").click()
            time.sleep(2)
            ForumDriver.getScreenshot()
        #2.不输入标题
            self.driver.find_element(By.CSS_SELECTOR, "#article_post_borad > option:nth-child(4)").click()
            time.sleep(2)
            self.driver.find_element(By.CSS_SELECTOR,"#article_post_title").clear()
            time.sleep(2)
            # 定位到输入标题的位置
            title_label = self.driver.find_element(By.CSS_SELECTOR, "#article_post_title")

            # tab键跳转到输入内容的位置
            title_label.send_keys(Keys.TAB)  # 重点
            ele = self.driver.switch_to.active_element

            # 正常输入内容
            ele.send_keys("你好")
            self.driver.execute_script("window.scrollBy(0,10000);")
            time.sleep(2)
            self.driver.find_element(By.CSS_SELECTOR, "#article_post_submit").click()
        #成功发布
            self.driver.find_element(By.CSS_SELECTOR, "#article_post_borad > option:nth-child(4)").click()
            time.sleep(2)
            self.driver.find_element(By.CSS_SELECTOR, "#article_post_title").send_keys("123")
            time.sleep(2)
            # 定位到输入标题的位置
            title_label = self.driver.find_element(By.CSS_SELECTOR, "#article_post_title")

            # tab键跳转到输入内容的位置
            title_label.send_keys(Keys.TAB)  # 重点
            ele = self.driver.switch_to.active_element

            # 正常输入内容
            ele.send_keys("你好")
            self.driver.execute_script("window.scrollBy(0,10000);")
            time.sleep(2)
            self.driver.find_element(By.CSS_SELECTOR, "#article_post_submit").click()
            time.sleep(2)
            ForumDriver.getScreenshot()




    #个人信息区域
    def PIAPage(self):
        self.driver.find_element(By.CSS_SELECTOR,"#index_nav_avatar").click()
        ForumDriver.getScreenshot()
        #点击我的帖子
        self.driver.find_element(By.CSS_SELECTOR,"#index_user_profile").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        self.driver.find_element(By.CSS_SELECTOR,"#nav_board_index > a > span.nav-link-title").click()
        time.sleep(2)
        #点击个人中心
        self.driver.find_element(By.CSS_SELECTOR, "#index_nav_avatar").click()
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#index_user_settings").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        tte=self.driver.find_element(By.CSS_SELECTOR,"#settings_nickname").text
        print(tte)
        assert tte == "333"
        ForumDriver.getScreenshot()
        # 异常修改，内容不变，点击修改
        self.driver.find_element(By.CSS_SELECTOR, "#setting_submit_nickname").click()
        ForumDriver.getScreenshot()
        # 异常修改，不输入内容
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_nickname").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#setting_submit_nickname").click()
        ForumDriver.getScreenshot()
        #修改昵称成功修改
        self.driver.find_element(By.CSS_SELECTOR,"#setting_input_nickname").clear()
        self.driver.find_element(By.CSS_SELECTOR,"#setting_input_nickname").send_keys("123")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#setting_submit_nickname").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        time.sleep(5)

        #修改邮箱
        # 异常修改，内容不变

        self.driver.find_element(By.CSS_SELECTOR, "#setting_submit_email").click()
        time.sleep(2)
        ForumDriver.getScreenshot()

        #异常修改,不输入内容
        self.driver.find_element(By.CSS_SELECTOR,"#setting_input_email").clear()

        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#setting_submit_email").click()
        ForumDriver.getScreenshot()
        #正常修改
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_email").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_email").send_keys("123")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#setting_submit_email").click()
        ForumDriver.getScreenshot()
        time.sleep(2)



        self.driver.execute_script("window.scrollBy(0,100);")
        #修改电话号码
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#setting_submit_phoneNum").click()
        time.sleep(2)
        ForumDriver.getScreenshot()

        # 异常修改,不输入内容
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_phoneNum").clear()

        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#setting_submit_phoneNum").click()
        ForumDriver.getScreenshot()
        # 正常修改
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_phoneNum").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#setting_input_phoneNum").send_keys("123")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#setting_submit_phoneNum").click()
        ForumDriver.getScreenshot()
        time.sleep(2)

        #修改密码
        self.driver.execute_script("window.scrollBy(0,10000);")
        time.sleep(2)
        #1.原密码输入错误，新密码和确认密码一样
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").send_keys("666")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").send_keys("777")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").send_keys("777")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_password").click()
        time.sleep(3)
        ForumDriver.getScreenshot()
        # 2.原密码输入正确，新密码和确认密码不一样
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").send_keys("333")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").send_keys("777")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").send_keys("773")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_password").click()
        time.sleep(3)
        ForumDriver.getScreenshot()
        # 3.原密码输入错误，新密码输入和确认密码不一样
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").send_keys("33")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").send_keys("777")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").send_keys("773")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_password").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        # 4.原密码输入错误，新密码输入和确认密码不输入
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").send_keys("33")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_password").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        # 5.原密码输入正确，新密码输入和确认密码不输入
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").send_keys("333")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_password").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        # 6.原密码不输入，新密码输入和确认密码不输入
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").clear()
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_password").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        #正确修改
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").clear()
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_oldPassword").send_keys("333")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_newPassword").send_keys("777")
        self.driver.find_element(By.CSS_SELECTOR, "#settings_input_passwordRepeat").send_keys("777")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_password").click()
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#bit-forum-content > div.page-body > div > div > div > div.col.d-flex.flex-column > div > div:nth-child(14) > div > div > form > div:nth-child(1) > div > span > a > svg > path:nth-child(2)").click()
        self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-body > div > div > div > div.col.d-flex.flex-column > div > div:nth-child(14) > div > div > form > div:nth-child(2) > div > span > a > svg > path:nth-child(2)").click()
        self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-body > div > div > div > div.col.d-flex.flex-column > div > div:nth-child(14) > div > div > form > div:nth-child(3) > div > span > a > svg").click()
        time.sleep(2)
        ForumDriver.getScreenshot()

        #修改个人简介
        self.driver.execute_script("window.scrollBy(0,10000);")
        #异常修改，不变
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_remark").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        #异常修改，空
        self.driver.find_element(By.CSS_SELECTOR, "#settings_textarea_remark").clear()
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#settings_submit_remark").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        #正常修改
        self.driver.find_element(By.CSS_SELECTOR,"#settings_textarea_remark").clear()
        self.driver.find_element(By.CSS_SELECTOR,"#settings_textarea_remark").send_keys("lalalalallaa")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR,"#settings_submit_remark").click()
        time.sleep(2)
        ForumDriver.getScreenshot()
        # 退出
        self.driver.execute_script("window.scrollBy(10000，0);")
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#nav_board_index > a").click()
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#index_nav_avatar").click()
        time.sleep(2)
        self.driver.find_element(By.CSS_SELECTOR, "#index_user_logout > span").click()
        time.sleep(2)
        ForumDriver.getScreenshot()

    # #点击其他用户名,进入其他用户的个人主页
      #       self.driver.execute_script("window.scrollTo({top:0,behavior:'smooth'});")
      #       self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-body > div > div > div:nth-child(1) > div.col-3.card > div > h3").click()
      #       time.sleep(1)
      #       self.driver.find_element(By.CSS_SELECTOR,"#bit-forum-content > div.page-header.d-print-none > div > div > div.col > div > div:nth-child(1)")
      #   # # 定位到输入标题的位置
        # title_label = self.driver.find_element(By.CSS_SELECTOR, "#article_details_reply > div.CodeMirror.cm-s-default.CodeMirror-wrap > div.CodeMirror-scroll > div.CodeMirror-sizer > div > div > div > div.CodeMirror-code > div > pre")
        # # tab键跳转到输入内容的位置
        # title_label.send_keys(#article_details_reply > div.CodeMirror.cm-s-default.CodeMirror-wrap > div.CodeMirror-scroll > div.CodeMirror-sizer > div > div > div > div.CodeMirror-code > div > pre.TAB)  # 重点
        #  ele = self.driver.switch_to.active_element
        #  ele.send_keys("你好")

        #
        # self.driver.find_element(By.CSS_SELECTOR,"#article_details_reply > div.CodeMirror.cm-s-default.CodeMirror-wrap > div.CodeMirror-scroll > div.CodeMirror-sizer > div > div > div > div.CodeMirror-code > div > pre").send_keys("回复此帖子")
        # time.sleep(1)
        # self.driver.find_element(By.CSS_SELECTOR,"#details_btn_article_reply").click()
        # ForumDriver.getScreenshot()
        # Heldo=self.driver.current_window_handle
        # allHeldo=self.driver.window_handles
        # for handle in allHeldo:
        #     if handle != Heldo:
        #         self.driver.switch_to.window(handle)
        # ForumDriver.getScreenshot()
        # time.sleep(1)
        # self.driver.find_element(By.CSS_SELECTOR,"#article_details_author_name")
        # time.sleep(1)
        # #点赞数
        #
        # text1 = self.driver.find_element(By.CSS_SELECTOR, "#article_details_author_").text
        # print(text1)
        # self.driver.find_element(By.CSS_SELECTOR,"#details_btn_like_count").click()
        # ForumDriver.getScreenshot()
        # time.sleep(1)
        # #点赞数加1
        # text2=self.driver.find_element(By.CSS_SELECTOR,"#article_details_author_").text
        # print(text2)
        # ForumDriver.getScreenshot()
        # # # #点击发私信，进入私信页面
        # # # self.driver.find_element(By.CSS_SELECTOR,"#btn_details_send_message").click()
        # # # alter = self.driver.switch_to.alter
        # # alter.dismiss()
        # # #点击取消，返回帖子页面
        # # ForumDriver.getScreenshot()
        #
